package io.plus.utils.prop;

import io.plus.utils.lock.ReadWriteLockMap;

import java.util.HashMap;


public class ReadWriteLocPropertiesk implements Properties {

    private final ReadWriteLockMap<String, Object> lockMap = new ReadWriteLockMap<>(new HashMap<String, Object>(8));


    public ReadWriteLocPropertiesk() {
    }

    @Override
    public void setAttribute(String key, Object value) {
        set(key, value);
    }

    @Override
    public void removeAttribute(String key) {
        remove(key);
    }

    @Override
    public Object getAttribute(String key) {
        return get(key);
    }

    @Override
    public void clearAttribute() {
        lockMap.clear();
    }
    //


    /**
     * 同：setAttribute(String key, Object value)
     */
    public void set(String key, Object value) {
        lockMap.put(key, value);
    }

    /**
     * 同：removeAttribute(String key)
     */
    public void remove(String key) {
        lockMap.remove(key);
    }

    /**
     * 同：getAttribute(String key)
     */
    public Object get(String key) {
        return lockMap.getObject().get(key);
    }

    /**
     * 同：clearAttribute()
     */
    public void clear() {
        clearAttribute();
    }


}
